package com.neusoft.ysu.npms.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.neusoft.ysu.npms.mapper.HelpMapper;
import com.neusoft.ysu.npms.mapper.HelpmanMapper;
import com.neusoft.ysu.npms.pojo.Help;
import com.neusoft.ysu.npms.pojo.Helpman;
import com.neusoft.ysu.npms.pojo.Result;
import com.neusoft.ysu.npms.service.IHelpmanService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 作者：刘金秋
 * @since 2024-06-18
 */
@Service
public class HelpmanServiceImpl extends ServiceImpl<HelpmanMapper, Helpman> implements IHelpmanService {
    @Autowired
    HelpmanMapper helpmanMapper;

    @Override
    public Result add(Helpman helpman) {
        return new Result<>(0, "", helpmanMapper.add(helpman));
    }

    @Override
    public Result deleteHelpman(Helpman helpman){
        return new Result<>(0,"",helpmanMapper.deleteHelpman(helpman));
    }

    @Override
    public Result updateHelpman(Helpman helpman){
        return new Result<>(0,"",helpmanMapper.updateHelpman(helpman));
    }

    @Override
    public PageInfo selectAll(Helpman helpman, int pageNum, int pageSize){
        PageHelper.startPage(pageNum, pageSize);
        List<Helpman> infos=helpmanMapper.selectAll(helpman);
        return new PageInfo(infos);
    }
    @Override
    public Result findById(Helpman helpman){
        return new Result<>(0,"",helpmanMapper.findById(helpman));
    }
}
